home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 007a / jcal753.zip / JDB.PRG < prev    next >
Text File  |  1989-11-16  |  2KB  |  80 lines

  1. *   JDB.PRG demonstrates how to interface the JCAL utilities, J2GBIN
  2. *   and G2JBIN to dBase III+.
  3. set talk off
  4. set bell off
  5. set century on  && this is needed for a 4 digit year
  6. set status off
  7. set menu off
  8. set safety off
  9. set function 2 to 'do jdb;'
  10. set function 3 to 'modi comm jdb;'
  11. set function 4 to 'copy file jdb.bak to jdb.dbf;'
  12. load g2jbin
  13. load j2gbin
  14. clear
  15. text
  16. Each record of the database contains a name, a Gregorian date (date type)
  17. and a Jewish date (string type).
  18.  
  19. By selecting "1" from the menu you can view and edit the dates.
  20.  
  21. Then by selecting "2" or "3" from the menu you can have the JCAL utilities
  22. update the corresponding dates.
  23.  
  24. endtext
  25. wait
  26.  
  27. * file structure of jdb.dbf:
  28. * NAME  CHARACTER   15
  29. * GDATE DATE         8
  30. * JDATE CHARACTER   10
  31.  
  32. use jdb
  33. do while .t.
  34.     clear
  35.     ? ' 1  Edit/View Database'
  36.     ? ' 2  Update All Jewish Dates'
  37.     ? ' 3  Update All Gregorian Dates'
  38.     ? ' 4  Quit'
  39.     ?
  40.     Accept '   Make a choice  ' to choice
  41.     clear
  42.     if .not. choice $'1234'
  43.         ?? chr(7)
  44.         loop
  45.     endif
  46.     do case
  47.         case choice='1'
  48.             goto top
  49.             browse
  50.         case choice='2'
  51.             goto top
  52.             do while .not. eof()
  53.                 store dtoc(gdate) to param
  54. ***   pad with leading zeros to bring to length of 10 characters
  55.                 param=replicate('0',10-len(param))+param
  56.                 call g2jbin with param
  57.                 replace jdate with param
  58. ***  param in previous line contains the Jewish date string returned from g2jbin
  59.                 skip
  60.             enddo
  61.         case choice='3'
  62.             goto top
  63.             do while .not. eof()
  64.                 store trim(jdate) to jparam  && get rid of trailing blanks
  65. ***   pad with leading zeros to bring to length of 10 characters
  66.                 jparam=replicate('0',10-len(jparam))+jparam
  67.                 call j2gbin with jparam
  68.                 store ctod(jparam) to tempdate
  69. ***  jparam in previous line contains the Gregorian date string returned from j2gbin
  70.                 replace gdate with tempdate
  71.                 skip
  72.             enddo
  73.         case choice='4'
  74.             close database
  75.             release module g2jbin
  76.             release module j2gbin
  77.             exit
  78.     endcase
  79. enddo
  80.